package com.iyoudoock.citymine.activity.setting;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.iyoudoock.citymine.BaseActivity;
import com.iyoudoock.citymine.R;
import com.iyoudoock.citymine.constants.HttpUtils;
import com.kvin.toolkit.utils.ToastUtils;
import com.kvin.toolkit.utils.http.JsonHttpResponseHandler;
import com.kvin.toolkit.utils.http.JsonUtils;

import org.json.JSONObject;

import java.io.IOException;
import java.util.HashMap;

import butterknife.BindView;
import butterknife.ButterKnife;

public class FeedbackActivity extends BaseActivity {

    @BindView(R.id.advice_et)
    EditText adviceEt;
    @BindView(R.id.btn_submit)
    Button btnSubmit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);
        ButterKnife.bind(this);
    }

    @Override
    public void initNav() {
        setTitle("意见反馈");
    }

    @Override
    public void init() {
        mJsonUtils = JsonUtils.getInstance();
        btnSubmit.setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        String msg = adviceEt.getText().toString();
        if (TextUtils.isEmpty(msg)) {
            ToastUtils.simpleToast(this, "反馈内容不能为空");
        }
        params = HttpUtils.feedback(mUid, msg);

        mJsonUtils.post(HttpUtils.FEEDBACK_URL, params, this);

    }

    @Override
    public void onSuccess(JSONObject response, String flag) {
        super.onSuccess(response, flag);
        if (response == null) return;
    }

    @Override
    public void onFailure(IOException e, String flag) {
        super.onFailure(e, flag);
    }
}
